package de.slothsoft.commons.swing.editorview;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import de.slothsoft.commons.res.CommonImages;
import de.slothsoft.commons.res.CommonMessages;
import de.slothsoft.commons.swing.JToolBarManager;

public abstract class AbstractTitleView extends AbstractView {

	private static final long serialVersionUID = 1L;

	protected Component createToolBar() {
		JToolBarManager manager = new JToolBarManager();
		manager.getToolBar().setFloatable(false);
		createToolbar(manager);
		return manager.getToolBar();
	}

	protected void createToolbar(JToolBarManager manager) {
		// to be overriden
	}

	protected void createSytemToolbar(JToolBarManager manager) {
		manager.add(CommonImages.get(CommonImages.TOOLBAR_CLOSE),
				CommonMessages.getString("Dialog.close"), new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent arg0) {
						closeView();
					}
				});
	}

}
